package org.bigk.invoices.services;

import java.util.Date;
import java.util.List;

import org.bigk.invoices.exceptions.ServiceException;
import org.bigk.invoices.model.PaymentKind;

/**
 * The service provides information about payment kinds.
 * 
 * @author 125914
 *
 */
public interface PaymentKindsService {

	/**
	 * List all possible payment kinds.
	 * 
	 * @return list of all possible payment kinds
	 * @throws ServiceException
	 *             when error whilst data retrieving occurs
	 */
	public abstract List<PaymentKind> listAllItems() throws ServiceException;

	/**
	 * Reads payment kind for given id.
	 * 
	 * @param id
	 *            identifier of payment kind to read
	 * @return payment kind object for given id
	 * @throws ServiceException
	 *             when error whilst data retrieving occurs
	 */
	public abstract PaymentKind getPaymentKind(Long id)
			throws ServiceException;

	/**
	 * This method calculates payment date for given base date and payment kind
	 * id. In details: payment kind object (rule) is read for given payment kind
	 * id, and then payment date is calculated with this payment kind object and
	 * input date parameter.
	 * 
	 * @param date
	 *            base date
	 * @param paymentKindId
	 *            payment kind identifier
	 * @return calculated payment date
	 * @throws ServiceException
	 *             when error whilst data retrieving occurs
	 */
	public abstract Date calculatePaymentDate(Date date, Long paymentKindId)
			throws ServiceException;

	/**
	 * This method calculates payment date for given base date and rule.
	 * 
	 * @param date
	 *            base date
	 * @param rule
	 *            payment kind value
	 * @return calculated payment date
	 * @throws ServiceException
	 *             when error whilst data retrieving occurs
	 */
	public abstract Date calculatePaymentDate(Date date, String rule)
			throws ServiceException;
}
